from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from apps.projects.models import *

class CategoryAdmin(admin.ModelAdmin):
    """
    Administration interface options of ``Category`` model.
    """
    list_display = ('name', 'slug', )
    search_fields = ('name',)
    save_on_top = True
    prepopulated_fields = {'slug': ('name',)}

class ProjectAdmin(admin.ModelAdmin):
    """
    Administration interface options of ``Entry`` model.
    """
    list_display = ('name', 'category', 'creation_date')
    search_fields = ('name', 'description','requirements')
    date_hierarchy = 'creation_date'
    fieldsets = (
        (_('Headline'), {'fields': ( 'name', 'slug', 'category',)}),
        (_('Body'), {'fields': ('description','requirements', )}),
    )
    save_on_top = True
    prepopulated_fields = {'slug': ('name',)}

admin.site.register(Category, CategoryAdmin)
admin.site.register(Project, ProjectAdmin)
